﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class student_generateRadio : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //获取试卷信息
        string sqlTest = "select radio_questions_sum,mutil_questions_sum,judge_questions_sum,answer_questions_sum from tb_test_questions";
        System.Data.DataTable dt1 = SqlServer.GetDataTable(sqlTest);
        Session["radio_questions_sum"] = dt1.Rows[0][0].ToString();
        Session["mutil_questions_sum"] = dt1.Rows[0][1].ToString();
        Session["judge_questions_sum"] = dt1.Rows[0][2].ToString();
        Session["answer_questions_sum"] = dt1.Rows[0][3].ToString();

        string test_question_id = Request.QueryString["test_question_id"].ToString().Trim();
        string sql = "select top " + Session["radio_questions_sum"] + " radio_question_id ,radio_question_title,option_a,option_b,option_c,option_d ,correct_answer,question_score from tb_radio_questions where course_id in (select course_id from tb_test_info where test_question_id ='" + test_question_id + "') order by NEWID()";
        System.Data.DataTable dt = SqlServer.GetDataTable(sql);
        Session["radio_answer"] = dt.DefaultView.ToTable(false,new string[]{"correct_answer","question_score"});
        dt.Columns.RemoveAt(dt.Columns.Count -1);
        dt.Columns.RemoveAt(dt.Columns.Count -1);
        //转为文本串；
        Response.Write(Json.ToJson(dt, 20));
        Response.End();

    }
}